import React, { Component } from 'react'
import './jifenshop.scss'
import axios from '../../../axios/axios'
import { Link } from 'react-router-dom'
import { Pagination,Carousel } from 'antd';
function itemRender(current, type, originalElement) {
    if (type === 'prev') {
      return <a>上一页</a>;
    }
    if (type === 'next') {
      return <a>下一页</a>;
    }
    return originalElement;
  }
export default class jifenshop extends Component {
    constructor(props) {
        super(props);
        this.state = {
            arr: []
        }
    }
    componentWillMount(){
        axios.get('small/commodity/v1/commodityList').then(res=>{
            console.log(res)
            var arr =res.data.result.rxxp.commodityList.concat(res.data.result.pzsh.commodityList,res.data.result.mlss.commodityList);
            this.setState({
                arr:arr
            })
        });
    }
    render() {
        return (
            <div className="jifenshop">
                <Carousel autoplay className="jingtou">
                <div><img src={require('../../../img1/jifenbanner.png').default} alt=""/></div>
                <div><img src={require('../../../img1/jifenbanner.png').default} alt=""/></div>
                <div><img src={require('../../../img1/jifenbanner.png').default} alt=""/></div>
                <div><img src={require('../../../img1/jifenbanner.png').default} alt=""/></div>  
                </Carousel>
                <div className="jingpu">
                <div className="jxpp-list jfshop-list container">{
                    this.state.arr.map((v,i)=>{
                        return(<div key={v.commodityId}>
                            <img src={v.masterPic} alt="" />
                            <span>自家礼包送亲人，送朋友的
不二选择自家礼包送亲人..</span>
                            <p>
                                <span>积分：{v.price}</span><i>价值￥{v.price+100}</i>
                            </p>
                            <p className="jifenduihuan">兑换</p>
                        </div>)
                    })

                }</div> 
            </div>   
            <div className="fenye">
                    <Link to="###">首页</Link>
                    <Pagination showSizeChanger={false} showQuickJumper total={500} itemRender={itemRender} />
                    <Link to="###">确定</Link>
                    <span>共500条</span>
             </div>  
            </div>
        )
    }
}
